﻿using IntelligentAgriculture.Contracts.Dto.Output;
using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.WebAPI.Application.Command.SheepCommand;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.SheepCommandHandler
{
    public class SheepDeleteCommandHandler : IRequestHandler<SheepDeleteCommand, Results<int>>
    {

        private readonly ISheepService sheepService;
        private readonly ILogger<SheepDeleteCommandHandler> logger;
        public SheepDeleteCommandHandler(ISheepService sheepService, ILogger<SheepDeleteCommandHandler> logger)
        {
            this.sheepService = sheepService;
            this.logger = logger;
        }

        /// <summary>
        /// 羊场删除
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<Results<int>> Handle(SheepDeleteCommand request, CancellationToken cancellationToken)
        {
            //var list = sheepService.Delete(request.SheepId, request.IdList);
            //var results = Results<int>.DataResult(list);
            //return results;
            var list = await sheepService.Delete(request.SheepId, request.IdList);
            return Results<int>.DataResult(list);


        }











    }




}
